import { createRouter, createWebHistory } from "vue-router";

export const leftMenu = [
  {
    path: "/home",
    name: "Home",
    component: () => import("src/manager/pages/module/pages/home/home.vue"),
    meta: {
      title: "首页",
      sort: 0,
    },
  },
  {
    path: "/personal-center",
    name: "PersonalCenter",
    component: () =>
      import("src/manager/pages/module/pages/personal-center/personal-center.vue"),
      meta: {
        title: "个人中心",
        sort: 10,
      },
  },
  {
    path: "/articleManage",
    name: "ArticleManage",
    component: () => import("src/manager/layout/layout.vue"),
    meta: {
      title: "内容管理",
      sort: 2,
    },
    children: [
      {
        path: "/tag",
        name: "Tag",
        component: () => import("src/manager/pages/module/pages/tag/tag.vue"),
        meta: {
          title: "标签管理",
        },
      },
      {
        path: "/essay",
        name: "Essay",
        component: () => import("src/manager/pages/module/pages/essay/essay.vue"),
        meta: {
          title: "短文管理",
        },
      },
      {
        path: "/recycling-station",
        name: "RecyclingStation",
        component: () =>
          import(
            "src/manager/pages/module/pages/recycling-station/recycling-station.vue"
          ),
        meta: {
          title: "回收站",
        },
      },
    ],
  },
  {
    path: "/util",
    name: "Util",
    component: () => import("src/manager/layout/layout.vue"),
    meta: {
      title: "工具管理",
      sort: 2,
    },
    children: [
      {
        path: "/draw",
        name: "Draw",
        component: () => import("src/manager/pages/module/pages/draw/draw.vue"),
        meta: {
          title: "草稿管理",
        },
      },
      {
        path: "/database",
        name: "DataBase",
        component: () => import("src/manager/pages/module/pages/database/database.vue"),
        meta: {
          title: "数据仓库",
        },
      },
      {
        path: "/excel",
        name: "Excel",
        component: () => import("src/manager/pages/module/pages/excel/excel.vue"),
        meta: {
          title: "导入导出",
        },
      },
    ],
  },
];

const routes = [
  {
    path: "/",
    name: "System",
    redirect: "/home",
    component: () => import("src/manager/pages/module/index.vue"),
    children: leftMenu,
  },
  {
    path: "/write-notes",
    name: "WriteNotes",
    component: () => import("src/manager/pages/write-notes/write-notes.vue"),
  },
  {
    path: "/draw-image",
    name: "DrawImage",
    component: () => import("src/manager/pages/draw-image/draw-image.vue"),
  },
  {
    path: "/register",
    name: "register",
    component: () => import("src/manager/pages/register/register.vue"),
  },
  {
    path: "/login",
    name: "login",
    component: () => import("src/manager/pages/login/login.vue"),
  },
];

const router = createRouter({
  // history: createWebHashHistory('/nest-vue-short-passage-front'), // hash路由模式
  history: createWebHistory("/blog"), // history路由模式
  routes,
});

export default router;
